The present invention relates to validating templates, and in particular, to ensuring that an instantiated template will conform to a target language.
A markup language is a system for managing information and is used to code the information in a document by adding structure and metadata (i.e., information about data) to the document. Hypertext Markup Language (HTML) is an example of a widely used markup language. HTML is a specific language with its own vocabulary of tags and is used to establish the appearance and layout of a document as displayed in a browser. While HTML is simple to use, HTML tags are primarily formatting-oriented and do not provide information about the content of a document. This makes it cumbersome to reuse information in another context. Extensible Markup Language (XML) is another widely used markup language, which is designed to better handle the task of managing information. XML is more like a meta-language, which provides the grammar for developing custom markup languages, each with its own vocabulary. This is what makes XML “extensible,” and what makes XML so useful across a wide range of domains. Custom markup languages are sometimes referred to as XML applications or XML-based languages.
A wide number of tools use templates and template engines to transform data from one format to another. Extensible Stylesheet Language—Transformation (XSLT) is an example of such a tool. XSLT can, for example, create summary and full versions of the same document or convert a document from XML to HTML. Template-based transformations are ubiquitous in the software development world. Such a transformation process involves a template that organizes data. A template has placeholders (i.e., internal references) that stand in the place of content or data, which is not yet known or identified. In other words, placeholders denote incomplete portions within a template. During the transformation process (also referred to as instantiation), a template engine extracts data (also referred to as instantiation data) from a database or memory location and replaces the placeholders of the template with the data. The template engine produces a document (also referred to as an instantiated template) that is formatted in the target language.
A problem with conventional methods of instantiation is that the instantiated template needs to follow a set of rules that govern how the data is to be represented and organized. In other words, the instantiated template needs to conform to the target language, where descriptive tags are standard and uniform, and the data associated with the tags has a predictable format or range of values. If the instantiated template does not conform to the target language, applications written for the target language cannot properly process the document.
Target languages are typically defined by rules, or constraints, that govern the target language using what is referred to as a schema. The schema, also referred to as the target language schema, defines the target language by specifying the structure of the document: which elements and attributes are allowed, not allowed, or even required in the target language document. Document Type Definition (DTD) and XML Schema are examples of widely used schemas.
Conventional template engines are not able to ensure that an instantiated template will conform to the target language schema. Instantiated templates may be checked after the instantiation process, but such checking is error-prone (as the test might not include the instantiation data that leads to an error) and time consuming (if one tries to figure out whether the template or the instantiation data is causing the problem).
Thus, there is a need for improving the instantiation of templates. The present invention solves these and other problems by providing systems and methods of validating templates.